/*
 *
 * *******************************************************************
 *   @项目名称: BHex Android
 *   @文件名称: AbstractPresenter.java
 *   @Date: 11/29/18 3:21 PM
 *   @Author: chenjun
 *   @Copyright（C）: 2018 BlueHelix Inc.   All rights reserved.
 *   注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的.
 *  *******************************************************************
 *
 */

package io.bhex.baselib.mvp;

import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;

import java.io.Serializable;
import java.lang.ref.WeakReference;


//public class AbstractPresenter<V extends BaseUI> implements IPresenter<V> ,Serializable {
public class AbstractPresenter<V extends BaseUI> implements IPresenter<V> {

    protected BaseCoreActivity activity;

    private WeakReference<V> mUI;

    protected BaseCoreActivity getActivity() {
        return activity;
    }

    public V getUI() {
        return mUI == null ? null : mUI.get();
    }

    public Resources getResources() {
        return activity.getResources();
    }

    public String getString(int resId) {
        return getResources().getString(resId);
    }

    public void onUIReady(BaseCoreActivity activity, V ui) {
        this.activity = activity;
        this.mUI = new WeakReference<V>(ui);
    }

    @Override
    public void onStart() {

    }

    @Override
    public void onResume() {

    }

    @Override
    public void onPause() {

    }

    @Override
    public void onStop() {

    }

    @Override
    public void onDestroy() {

    }

    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {

    }

    @Override
    public void onRestoreInstanceState(Bundle savedInstanceState) {

    }

    @Override
    public void onSaveInstanceState(Bundle outState) {

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {

    }
}
